package com.ruoyi.paint.admin.domain.Dto;

import com.ruoyi.paint.admin.domain.result.ImportResult;

import java.util.LinkedHashMap;
import java.util.Map;

public class ImportSummary {
    private Map<String, ImportResult> sheetResults = new LinkedHashMap<>();
    private int totalSuccessCount;

    public void addSheetResult(String sheetName, ImportResult result) {
        sheetResults.put(sheetName, result);
        totalSuccessCount += result.getSuccessCount();
    }

    public boolean hasFailures() {
        for (ImportResult result : sheetResults.values()) {
            if (!result.getFailureMessages().isEmpty()) {
                return true;
            }
        }
        return false;
    }

    public int getTotalSuccessCount() {
        return totalSuccessCount;
    }

    public Map<String, ImportResult> getSheetResults() {
        return sheetResults;
    }
}